//
//  UIButton+Extension.swift
//  weibo
//
//  Created by 黄龙飞 on 15/11/22.
//  Copyright © 2015年 黄龙飞. All rights reserved.
//

import UIKit
extension UIButton{
    convenience init(title:String ,color:UIColor, imageName:String){
    self.init()
        setTitle(title, forState: UIControlState.Normal)
        setTitleColor(color, forState: UIControlState.Normal)
        setBackgroundImage(UIImage(named: imageName), forState: .Normal)
    }
    
    convenience init(imageName:String, backImageName:String){
        self.init()
//        let button = UIButton()
        setImage(UIImage(named:imageName), forState: UIControlState.Normal)
        setImage(UIImage(named: imageName + "_highlighted"), forState: UIControlState.Highlighted)
        setBackgroundImage(UIImage(named: backImageName), forState: UIControlState.Normal)
         setBackgroundImage(UIImage(named: backImageName + "_highlighted"), forState: UIControlState.Highlighted)
         sizeToFit()
    }
}
